import sys

def RecursionLoop (array, index, check, action, result = []):
    if action is None:
        return
    cnt = len(array)
    if index >= cnt:
        return
    temp = array [index]
    if not temp or len(temp) == 0:
        temp = [""]
    for item in temp:
        if check and not check(item, index):
            continue
        if index == len(result):
            result.append(item)
        else:
            result[index]=item
        if index + 1 == cnt:
            action (result)
        else:
            RecursionLoop(array, index+1, check, action, result)

def RemoveModules(moduleName):
    if type(moduleName) != type("") or moduleName == "":
        return
    if moduleName in sys.modules:
        sys.modules.pop(moduleName)
    if moduleName in globals():
        globals().pop(moduleName)
    if moduleName in locals():
        locals().pop(moduleName)